<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>物料详情</title>
    <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css" />
    <style type="text/css">
        .mui-table-view-chevron .mui-table-view-cell {
            padding-right: 20px!important;
        }

        h5 {
            color: #0062CC;
        }
        .box{
  				position: fixed;
  				top:-5px;
  				left: 10px;
  				z-index: 1000;
  				width: 100%;
  				height: 40px;
  				display: flex;
  				align-items: center;
  				justify-content: flex-start;
  			}
  			.box>div{
  				color: red;
  				font-weight: 600;
  				background-color: yellow;
          text-align: center;
          margin-right: 10px;
          display: none
  			}
    </style>
</head>

<body>
		<div class="box">
			<div id="earlyWarning">物料预警</div>
			<div id="overflow">物料溢出</div>
		</div>
    <div class="mui-content">
        <ul class="mui-table-view mui-table-view-chevron" id="stockDetailContent">
        	<script type="text/template" id="items">
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">SGMW ID：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5">{{datas.itemnum}}</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">仓库：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="cAssetAd">{{datas.location}}</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">库存地址：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="dfltstagebin">{{datas.binnum}}</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">描述：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="description">{{datas.description}}</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">规格：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="cSpcifications">{{datas.cSpcifications}}</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">部件制造号：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="cMPNum">{{datas.cMPNum}}</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">部件制造商：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="cM">{{datas.cM}}</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">部件制造商订货号：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="cMPId">{{datas.cMPId}}</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">序列号：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="cSerialno">{{datas.cSerialno}}</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">图纸号：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="cDrawingnum">{{datas.cDrawingnum}}</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">是否关键备件：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        {{if datas.cKeySparepart == 1}}
                        <span class="mui-h5" id="cKeySparepart">是</span>
                        {{else}}
                        <span class="mui-h5" id="cKeySparepart">否</span>
                        {{/if}}
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">OEM订货号：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="cOemid">{{datas.cOemid}}</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">当前库存数：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="physcnt">{{datas.curbal}}</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">当前库存价格：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="stdcost">{{datas.stdcost}}</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">一年消耗总量：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="stdcost">{{datas.issue1yrago}}</span>
                    </div>
                </div>
            </li>
            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-4">
                        <h5 class="mui-ellipsis">历史消耗总量：</h5>
                    </div>
                    <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                        <span class="mui-h5" id="stdcost">{{datas.issueyrago}}</span>
                    </div>
                </div>
            </li>
           </script>
        </ul>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script src="../script/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/common.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/template.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var itemnum, locations, address, invbalancesid,binnum;
apiready = function() {
  onLoadData();
  api.addEventListener({
      name: 'upDataPage'
  }, function(ret, err) {
    if(ret.value.isrefersh == 'yes'){
      onLoadData(1,false)
    }
  });
  api.addEventListener({
      name:'navitembtn'
  },function(ret, err){
      if(ret.type == 'right'){
        api.actionSheet({
          title: '请选择一项操作',
          cancelTitle: '取消',
          buttons: ['出库', '调整标准成本', '盘点', '白条记录', '调整当前余量', '查看出库记录', '查看入库记录', '查看调整记录', '修改库存地址']
      }, function(ret, err) {
          var index = ret.buttonIndex;
          switch (index) {
            case 1:
            openSaveWin('stock_out','物料出库',{
              address:address,
              itemnum:itemnum,
              invbalancesid:invbalancesid,
              binnum: binnum
            });break;
            case 2:
            openSaveWin('stock_adjust_allowance', '调整标准成本',{
            	itemnum: itemnum,
            	locations: locations
            });break;
            case 3:
            openSaveWin('stock_check', '盘点',{
            	itemnum: itemnum,
            	locations: locations
            });break;
            case 4:
            openSaveWin('blank_note', '白条记录',{
              inventoryid: api.pageParam.inventoryid,
				itemid: api.pageParam.itemid || '',
				itemnum:itemnum,
				binnum: api.pageParam.binnum ||''
            });break;
            case 5:
            openSaveWin('stock_allowance', '调整当前余量',{
            	itemnum: itemnum,
            	locations: locations
            });break;
            case 6:
            openTastWin('stock_out_record', '查看出库记录', {
            	inventoryid: api.pageParam.inventoryid,
            	itemnum: itemnum,
              	stockid: api.pageParam.stockid,
              	recordType: 2
            });break;
            case 7:
            openTastWin('stock_out_record', '查看入库记录', {
            	inventoryid: api.pageParam.inventoryid,
            	itemnum: itemnum,
              	stockid: api.pageParam.stockid,
              	recordType: 1
            });break;
            case 8:
            openTastWin('stock_out_record2', '查看调整记录', {
            	itemnum: itemnum,
              	stockid: api.pageParam.stockid,
              	location: locations,
              	inventoryid: api.pageParam.inventoryid,
              	recordType: 3
            });break;
            case 9:
            openSaveWin('stock_editAddress', '修改库存地址',{
            	itemnum: itemnum,
            	locations: locations
            });break;
          }
      });
      }
    });
  }
	function onLoadData () {
		ajaxrd("queryItemDetail", {
			inventoryid: api.pageParam.inventoryid || '',
			itemnum: api.pageParam.itemid || '',
			binnum: api.pageParam.binnum ||''
		}, function(ret, err) {
			api.refreshHeaderLoadDone()
			AddData('items','stockDetailContent',ret, false)
			itemnum = ret.itemnum
			binnum = ret.binnum
			locations = ret.location
	    address = ret.location
	    invbalancesid = ret.invbalancesid
      if (ret.earlyWarning == 1) {
        document.getElementById('earlyWarning').style.display = 'block'
      }
      if (ret.overflow == 1) {
        document.getElementById('overflow').style.display = 'block'
      }
		})
	}

</script>

</html>
